- content_for(:title, 'Deploy')
- content_for(:body_id, 'deployments_flow')

%h1 Deployment Settings

.deployment-metadata{ data: { refresh_path: deployment_target_metadata_refreshes_path(@deployment_target) } }
  %h3 Target
  %dl
    %dt Endpoint
    %dd= @deployment_target.endpoint_url
%h2.template-name
  = @resource.name

= form_for @deployment_form, url: deployment_target_deployments_path(@deployment_form.deployment_target_id), html: { class: 'deployment-settings' } do |f|
  = f.hidden_field :resource_id
  = f.hidden_field :resource_type
  = f.hidden_field :deployment_target_id
  = f.fields_for :images do |image_fields|
    - index = image_fields.options[:child_index]
    = image_fields.hidden_field :name
    .deployment-item
      %h3.image-name.expand{ class: ('expanded' if index == 0), data: { toggle: { class: 'expanded' } }}
        = image_fields.object.name
      .tab-container
        .tabs.column
          .hide
            %label{ for: 'hide' }
              .icon
              .text Hide Tabs
          .tab
            %label{ for: 'vars' }
              .icon
              .text Environment Variables
          .tab
            %label{ for: 'options' }
              .icon
              .text
                Options
        .cards.column
          .card.vars
            .content
              .title
                %h3 Environment Variables

              .environment-variables
                = image_fields.fields_for :environment do |env_var|
                  - index = env_var.options[:child_index]

                  %dl.entries
                    %dt.variable-name
                      = env_var.label(:value, env_var.object.variable)
                      = env_var.hidden_field :variable
                    %dd.variable-value
                      = env_var.text_field :value, placeholder: 'enter a value'

          = image_fields.fields_for :deployment do |deploy_fields|
            .card.options
              .content
                .title
                  %h3 Options
                  %dl.entries
                    %p
                      %dt.variable-name
                        = deploy_fields.label :count, 'Deploy Count'
                      %dd.variable-value
                        = deploy_fields.select :count, options_for_select(deployment_count_options), {}, class: 'fancy'
  = f.button 'Deploy to Target', class: "deploy button-positive"
